﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using NjaNjam.MongoRepository;
using NjamNjam.Model.Entities;

namespace NjamNjam.Web.Controllers
{
    public class AdministracijaController : Controller
    {
        private MongoRepository m_Repository = new MongoRepository();

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult VrsteRestorana()
        {
            return View();
        }

        public ActionResult VrstePonude()
        {
            var model = m_Repository.VrstePonude();
            return View(model);
        }



        #region Callbacks

        public ActionResult NovaVrstaPonude(VrstaPonude vrstaPonude)
        {
            m_Repository.Sacuvaj(vrstaPonude);
            var model = m_Repository.VrstePonude();
            return PartialView("VrstePonudeGridView", model);
        }

        public ActionResult ObrisiVrstuPonude(VrstaPonude vrstaPonude)
        {
            m_Repository.Obrisi(vrstaPonude);
            var model = m_Repository.VrstePonude();
            return PartialView("VrstePonudeGridView", model);
        }

        public ActionResult AzurirajVrstuPonude(VrstaPonude vrstaPonude)
        {
            m_Repository.Sacuvaj(vrstaPonude);
            var model = m_Repository.VrstePonude();
            return PartialView("VrstePonudeGridView", model);
        }
        
        public PartialViewResult gvVrstePonudeCallback()
        {
            var model = m_Repository.VrstePonude();
            return PartialView("VrstePonudeGridView", model);
        }

        #endregion
    }
}
